package com.sugon.controller.device;

import com.sugon.entity.DevAlarmRecordEntity;
import com.sugon.service.DevAlarmRecordService;
import com.sugon.utils.PageUtils;
import com.sugon.utils.Query;
import com.sugon.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * ${comments}Controller
 *
 * @author sugon
 * @date 2020-12-25 10:32:37
 */
@Controller
@RequestMapping("devalarmrecord")
public class DevAlarmRecordController {
    @Autowired
    private DevAlarmRecordService devAlarmRecordService;

    /**
     * 查看列表
     */
    @RequestMapping("/list")
    @ResponseBody
    public R list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);

        List<DevAlarmRecordEntity> devAlarmRecordList = devAlarmRecordService.queryList(query);
        int total = devAlarmRecordService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(devAlarmRecordList, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }

}
